]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Defer updating results on allocation changes until redraw
authorJonas Dreßler <verdre@v0yd.nl>
Wed, 7 Aug 2019 15:39:25 +0000 (17:39 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Thu, 8 Aug 2019 17:37:12 +0000 (17:37 +0000)
Since the `notify::allocation` signal will obviously get emitted while
the actor is inside an allocation cycle and we might end up doing
changes to its allocation inside `updateSearch` by hiding or showing the
actor (which queues a relayout), we get a warning from Clutter.

Fix this by delaying the call to the parent method until the next
redraw, which should happen a few moments after the current relayout.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/672

js/ui/search.js

index 7a7a5071fc69a2695967651ed86959e7b4cba5d1..d55021ac91994e0443853a7308b20d5714c642cb 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
 const Signals = imports.signals;
 
 const AppDisplay = imports.ui.appDisplay;
@@ -348,7 +348,10 @@ var GridSearchResults = class extends SearchResultsBase {
         // Make sure the maximum number of results calculated by
         // _getMaxDisplayedResults() is updated after width changes.
         this._notifyAllocationId = this.actor.connect('notify::allocation', () => {
-            super.updateSearch(...args);
+            Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+                super.updateSearch(...args);
+                return GLib.SOURCE_REMOVE;
+            });
         });
 
         super.updateSearch(...args);